package Runnable;

public class Test1 {
    public static void main(String[] args) {
        Runnable r = new MyRunnable();
        //将线程任务对象r提交到线程池中
        Thread t = new Thread(r);
        t.start();
        for (int i = 0; i < 10; i++) {
            System.out.println("主线程" + i);
        }
    }
}
//线程任务类
 class MyRunnable implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("子线程"+i);
        }
    }
}
